package com.ruoyi.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

@Getter
@AllArgsConstructor
public enum PushTypeEnum {

    // 双重预防 
    DOUBLE_PREVENTION_RECEIVE_UNIT_LIST("安全风险分析单元", "/v1/data/receive/receiveUnitList"),
    DOUBLE_PREVENTION_RECEIVE_EVENT_LIST("安全风险事件", "/v1/data/receive/receiveEventList"),
    DOUBLE_PREVENTION_RECEIVE_CONTROL_MEASURES_LIST("安全风险管控措施", "/v1/data/receive/receivecontrolMeasuresList"),
    DOUBLE_PREVENTION_RECEIVE_MEASURES_TASK_LIST("安全风险清单/隐患排查任务配置", "/v1/data/receive/receiveMeasuresTaskList"),
    DOUBLE_PREVENTION_RECEIVE_MEASURES_TASKRECORD_LIST( "隐患排查任务记录", "/v1/data/receive/receiveMeasuresTaskRecordList"),
    DOUBLE_PREVENTION_RECEIVE_DANGER_INVESTIGATION_LIST("隐患记录和隐患治理用一个接口", "/v1/data/receive/receiveDangerInvestigationList"),
    // 专项检查
    SPECIAL_INSPECTION_RECEIVE_CHECK_DANGER("专项检查隐患信息", "/v1/data/receive/receivecheckDanger"),
    SPECIAL_INSPECTION_RECEIVE_CHECK_RECORD("专项检查记录", "/v1/data/receive/receivecheckRecord"),
    // 平台报警
    PLATFORM_ALARM_RECEIVE_WORKORDER_LIST("上报特殊作业票证信息", "/v1/data/oilGasstorage/receiveWorkorderList"),
    PLATFORM_ALARM_RECEIVE_EMPLOYEE_LIST("上报人员基础信息", "/v1/data/oilGasstorage/receiveEmployeeList"),
    PLATFORM_ALARM_RECEIVE_EMPLOVEE_POSITION_LIST("上报人员实时定位数据", "/v1/data/oilGasstorage/receiveEmploveePositionList"),
    PLATFORM_ALARM_RECEIVE_VIDEO_ALARM_LIST("上报视频智能分析数据", "/v1/data/oilGasstorage/receiveVideoAlarmList"),
    PLATFORM_ALARM_RECEIVE_THUNDER_WARNING_EQUIP_LIST("上报雷电预警设备基础信息", "/v1/data/oilGasstorage/receiveThunderWarningEquipList"),
    PLATFORM_ALARM_RECEIVE_THUNDER_WARNING_LIST("上报雷电预警数据", "/v1/data/oilGasstorage/receiveThunderWarningList"),
    PLATFORM_ALARM_RECEIVE_THUNDER_ENVIRON_MONITOR_LIST("上报环境监测数据", "/v1/data/oilGasstorage/receiveThunderEnvironMonitorList");

    private final String pushType;
    private final String url;

    //通过url获取上报类型
    public static String getPushType(String inputUrl) {
        for (PushTypeEnum pushTypeEnum : PushTypeEnum.values()) {
            if (inputUrl.contains(pushTypeEnum.getUrl())) {
                return pushTypeEnum.getPushType();
            }
        }
        return null;
    }

    //通过url获取上报类型
    public static PushTypeEnum getPushTypeEnum(String inputUrl) {
        for (PushTypeEnum pushTypeEnum : PushTypeEnum.values()) {
            if (inputUrl.contains(pushTypeEnum.getUrl())) {
                return pushTypeEnum;
            }
        }
        return null;
    }
}
